\documentclass[11pt]{mathese}
\usepackage[pdftex]{graphicx}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,bbm} % math, mathbb, mathbbm
\usepackage{verbatim}     %pour le code source
\usepackage{listings}     %pour le code source
\usepackage[left]{lineno} %numerote les lignes
\usepackage{float}
%\usepackage[cm]{aeguill}
\usepackage{lmodern}

\usepackage{url}      %% pour citer les url par \url
\usepackage{natbib}   %% pour plus de flexibilite dans les citations
\usepackage{makeidx}  %% index
\usepackage{rotating} %% pour rotate+6
\usepackage{multirow} %% pour regrouper un texte sur plusieurs lignes dans une table\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage[section]{placeins}
\usepackage{pstricks}
\usepackage{tikz}
\usepackage{subfigure}
\headheight = 13.6pt % pour r\'epondre a un warning de fancyheader

%%%%%%%%%%%%%%%%%%%%%%%LIENS HYPERTEXT%%%%%%%%%%%%%%%%%


\input{tex/macro} % macros perso
\makeindex % creation de l'index
\graphicspath{{fig/}} % les figures sont dans le r\"\i{}\textquestiondown{}\ensuremath{\frac12}pertoire fig


\usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}%les marges

%%%%%%%%%%%%%%%%%%%%%%%METTRE LE SOMMAIRE DE CHAQUE CHAPITRE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[francais]{minitoc}
\setcounter{minitocdepth}{1}



%%%%%%%%%%%%%%%%%%%%%%PIED DE PAGE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\fancyfoot[L]{EDF} 
\fancyfoot[R]{ENSEIRB} 

%%%%%%%%%%%%%%%%%%%%%%%STYLE DES CHAPITRES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newlength{\chapter@number@width}
\def\@makechapterhead#1{%
  {\normalfont
  \setlength{\parindent}{0pt}%
  \vspace*{10pt}%
  \settowidth{\chapter@number@width}{%
    \hbox{\color{white}\LARGE\bfseries
          \hspace{\dimexpr 1mm+3pt}%
          \thechapter
          \hspace{\dimexpr 1mm+3pt}%
    }}
  \hbox{%
    \vtop{%
      \hsize=\dimexpr\chapter@number@width+\tabcolsep+2\fboxrule+\tabcolsep
      \begin{tabular}[t]{@{}c}
        \scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill}\@chapapp\hspace{0pt plus 1 fill minus 1 fill}} \\
        \fboxsep=0pt
        \colorbox{black}{\vbox{%
           \hbox{\vbox to \dimexpr 1mm+3pt{}}
           \hbox{\color{white}\LARGE\bfseries
                 \hspace{\dimexpr 1mm+3pt}%
                 \thechapter
                 \hspace{\dimexpr 1mm+3pt}%
                }
           \hrule height 0.4pt depth 0pt width 0pt
           \hbox{\vbox to 6pt{}}
           \hbox{\parbox{0pt}{\Huge\bfseries\vphantom{E}}}
           }}%
      \end{tabular}%
      }%
    \vtop{%
      \advance\hsize by -\dimexpr\chapter@number@width+2\fboxrule+\tabcolsep
      \hspace*{-0.5cm}\begin{tabular}[t]{c}
        \scshape\strut\vphantom{\@chapapp} \\
        \fboxsep=0pt
        \colorbox{white}{\vbox{%
           \hbox{\vbox to \dimexpr 1mm+3pt{}}
           \hbox{\LARGE\bfseries
                 \hspace{\dimexpr 1mm+3pt}%
                 \phantom{\thechapter}
                 \hspace{\dimexpr 1mm+3pt}%
                }
           \hrule height 0.4pt depth 0pt width \hsize
           \hbox{\vbox to 6pt{}}
           \hbox{\hspace*{20pt}\parbox{\dimexpr\textwidth-2mm-6pt-\chapter@number@width-\tabcolsep-2\fboxrule-20pt}{\Huge\bfseries #1}}
           }}%
      \end{tabular}%
      }%
    }%
  \vspace{50pt}%
  }
}
\def\@makeschapterhead#1{%
  {\normalfont
  \setlength{\parindent}{0pt}%
  \vspace*{10pt}%
  \settowidth{\chapter@number@width}{%
    \hbox{\color{white}\LARGE\bfseries
          \hspace{\dimexpr 1mm+3pt}%
          \thechapter
          \hspace{\dimexpr 1mm+3pt}%
    }}
  \hbox{%
    \vtop{%
      \hsize=\dimexpr\chapter@number@width+\tabcolsep+2\fboxrule+\tabcolsep
      \begin{tabular}[t]{@{}c}
        \scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill}\phantom{\@chapapp}\hspace{0pt plus 1 fill minus 1 fill}} \\
        \fboxsep=0pt
        \colorbox{black}{\vbox{%
           \hbox{\vbox to \dimexpr 1mm+3pt{}}
           \hbox{\color{white}\LARGE\bfseries
                 \hspace{\dimexpr 1mm+3pt}%
                 \phantom{\thechapter}%
                 \hspace{\dimexpr 1mm+3pt}%
                }
           \hrule height 0.4pt depth 0pt width 0pt
           \hbox{\vbox to 6pt{}}
           \hbox{\parbox{0pt}{\Huge\bfseries\vphantom{E}}}
           }}%
      \end{tabular}%
      }%
    \vtop{%
      \advance\hsize by -\dimexpr\chapter@number@width+2\fboxrule+\tabcolsep
      \hspace*{-0.5cm}\begin{tabular}[t]{c}
        \scshape\strut\vphantom{\@chapapp} \\
        \fboxsep=0pt
        \colorbox{white}{\vbox{%
           \hbox{\vbox to \dimexpr 1mm+3pt{}}
           \hbox{\LARGE\bfseries
                 \hspace{\dimexpr 1mm+3pt}%
                 \phantom{\thechapter}
                 \hspace{\dimexpr 1mm+3pt}%
                }
           \hrule height 0.4pt depth 0pt width \hsize
           \hbox{\vbox to 6pt{}}
           \hbox{\hspace*{20pt}\parbox{\dimexpr\textwidth-2mm-6pt-\chapter@number@width-\tabcolsep-2\fboxrule-20pt}{\Huge\bfseries #1}}
           }}%
      \end{tabular}%
      }%
    }%
  \vspace{50pt}%
  }
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstset{ %
language=c,                     % the language of the code
basicstyle=\footnotesize,       % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
stepnumber=1,                   % the step between two line-numbers. If it's 1, each line 
                                % will be numbered
numbersep=5pt,                  % how far the line-numbers are from the code
backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
showspaces=false,               % show spaces adding particular underscores
showstringspaces=false,         % underline spaces within strings
showtabs=false,                 % show tabs within strings adding particular underscores
frame=single,                   % adds a frame around the code
tabsize=2,                      % sets default tabsize to 2 spaces
captionpos=b,                   % sets the caption-position to bottom
breaklines=true,                % sets automatic line breaking
breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
title=\lstname,                 % show the filename of files included with \lstinputlisting;
                                % also try caption instead of title
escapeinside={\%*}{*)},         % if you want to add a comment within your code
morekeywords={*,...}            % if you want to add more keywords to the set
}

\include{tex/garde}

\usepackage{hyperref}
\hypersetup{
colorlinks = false, linkcolor=black, citecolor=black, anchorcolor=green,
pdfstartview=FitH, pdffitwindow=true, pdfmenubar=true,
pdfcreator=PDFLaTeX, pdfproducer=PDFLaTeX, 
pageanchor=true, backref,
hyperindex=true}

\begin{document}
%%%%MINI SOMMAIRE%%%%%%
\dominitoc

\maketitle
\newpage\cleardoublepage
\input{tex/remerciments}
%\newpage\cleardoublepage
%\input{tex/citations}
\newpage\cleardoublepage
\input{tex/resume}
\newpage\cleardoublepage\thispagestyle{empty}
\markboth{Table des mati\`eres}{Table des mati\`eres}

\tableofcontents
\listoffigures  % table des figures
\listoftables   % table des tableaux

\input{tex/introduction} % chapitre 1
\input{tex/entreprise}   % chapitre 2
\input{tex/rappel}       % chapitre 3
\input{tex/outils}       % chapitre 4
\input{tex/etude_de_cas} % chapitre 5
\input{tex/techniques_mesure} % chapitre 6

%%%%%%%%%%%%%%%CONCLUSION UTILE%%%%%%%%%%%%%%%%%%%%%%%
\addcontentsline{toc}{chapter}{Conclusion}
\input{tex/conclusion}
\markboth{Conclusion}{Conclusion}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\addcontentsline{toc}{chapter}{Notations}
%\input{tex/notations}
%\markboth{Notations}{Notations}
%\appendix
%\input{tex/annexe1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\cleardoublepage
\bibliographystyle{plain}
\bibliography{bib/bibthese}
\addcontentsline{toc}{chapter}{Bibliographie}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newpage
%\cleardoublepage
%\addcontentsline{toc}{chapter}{Index}
%\markboth{Index}{Index}
%\printindex
%
\addcontentsline{toc}{chapter}{LD PRELOAD et libdl}
\addcontentsline{toc}{chapter}{backtrace, nm, addr2line}
\addcontentsline{toc}{chapter}{Code s\'equentiel t\'emoin}
\addcontentsline{toc}{chapter}{Code mutlithread\'e t\'emoin}
\end{document}
